package com.example.patient.controller;

import com.example.common.support.Result;
import com.example.patient.dto.req.*;
import com.example.patient.dto.resp.*;
import com.example.patient.service.DoctorService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @Author wxy
 * @Date 2021/1/18 13:13
 * @Version 1.0
 */
@RestController
@Api(tags = "医生")
@RequestMapping("/api/Doctor")
public class DoctorController {
    @Resource
    private DoctorService doctorService;

    @ApiOperation(value = "查询初始筛选项", notes = "查询初始筛选项")
    @PostMapping(value = "/FilterItem")
    public Result<FilterItemResp> FilterItem(@RequestBody FilterItemReq req) {
        return Result.success(doctorService.FilterItem(req));
    }

    @ApiOperation(value = "下级科室", notes = "下级科室")
    @PostMapping(value = "/GetCDep")
    public Result<GetCDepResp> GetCDep(@RequestBody GetCDepReq req) {
        return Result.success(doctorService.GetCDep(req));
    }

    @ApiOperation(value = "筛选医生", notes = "筛选医生")
    @PostMapping(value = "/DoctorList")
    public Result<PageInfo<DoctorListResp>> DoctorList(@RequestBody DoctorListReq req) {
        return Result.success(doctorService.DoctorList(req));
    }

    @ApiOperation(value = "医生详情", notes = "医生详情")
    @PostMapping(value = "/Detail")
    public Result<DetailResp> Detail(@RequestBody DetailReq req) {
        return Result.success(doctorService.Detail(req));
    }

    @ApiOperation(value = "关注、取消关注 医生", notes = "关注、取消关注 医生")
    @PostMapping(value = "/DoCollection")
    public Result<DoCollectionResp> DoCollection(@RequestBody DoCollectionReq req) {
        return Result.success(doctorService.DoCollection(req));
    }

    @ApiOperation(value = "就诊信息", notes = "就诊信息")
    @PostMapping(value = "/VisitInfo")
    public Result<VisitInfoResp> VisitInfo(@RequestBody VisitInfoReq req) {
        return Result.success(doctorService.VisitInfo(req));
    }

    @ApiOperation(value = "上传文件", notes = "上传文件")
    @PostMapping(value = "/VisitUpLoad")
    public Result<Object> VisitUpLoad(@RequestParam(value = "file") MultipartFile file) {
        return Result.success(doctorService.VisitUpLoad(file));
    }

    @ApiOperation(value = "是否存在有效问诊", notes = "是否存在有效问诊")
    @PostMapping(value = "/HaveInquiry")
    public Result<HaveInquiryResp> HaveInquiry(@RequestBody HaveInquiryReq req) {
        return Result.success(doctorService.HaveInquiry(req));
    }

    @ApiOperation(value = "提交就诊信息", notes = "提交就诊信息")
    @PostMapping(value = "/Visit")
    public Result<VisitResp> Visit(@RequestBody VisitReq req) {
        return Result.success(doctorService.Visit(req));
    }

    @ApiOperation(value = "创建问诊订单", notes = "创建问诊订单")
    @PostMapping(value = "/CreateOrder")
    public Result<CreateOrderResp> CreateOrder(@RequestBody CreateOrderReq req) {
        return Result.success(doctorService.CreateOrder(req));
    }

    @ApiOperation(value = "支付完成", notes = "支付完成")
    @PostMapping(value = "/PayCompletion")
    public Result<DoctorPayCompletionResp> PayCompletion(@RequestBody PayCompletionReq req) {
        return Result.success(doctorService.PayCompletion(req));
    }
}
